<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>教务综合管理系统</title>
    <link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/asserts/css/demo.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/asserts/css/ready.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/asserts/css/ready.min.css}">
    <script type="text/javascript" th:src="@{/js/Vue.js}"></script>
    <!-- 引入组件库 -->
    <script type="text/javascript" th:src="@{/js/element-ui.js}"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" th:href="@{/css/element-ui.css}"/>

<!--    easyTable-->
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/vue-easytable/umd/css/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/vue-easytable/umd/js/index.js"></script>

    <style>

        [v-cloak] {
            display: none !important;
        }

        .mychild>input{
            margin: 5px ;
        }

        input , textarea{
            border: none;
            width: 100%;
            height: 100%;
            background: rgba(210, 205, 212, 0.45);
            resize:none;
        }

    </style>

</head>
<body>

<div id="app">

    <table v-show="!ifShow" id="table" style="table-layout:fixed; overflow:hidden;width: 90%" border="1" bgcolor="#fff" cellspacing="0" align="center">
        <div v-show="!ifShow" align="center" style="font-size: 25px; margin-bottom: 15px;">湖南工业职业技术学院专业技术人员工作量申报/审核表</div>

        <div v-show="!ifShow" align="center" style="margin-bottom: 15px;">
            <input @change="updateWorkload" type="number" v-model="newWorkloadDTO.year" style="width: auto">
            年
            <select @change="updateWorkload" v-model="newWorkloadDTO.trem">
                <option>上</option>
                <option>下</option>
            </select>
            学期
            <u>{{workloadDTO.institute}}</u>学院&emsp;&emsp;&emsp;&emsp;
            <u>{{workloadDTO.section}}</u>教研室
        </div>

        <!--姓名 性别 年龄 职称 职务-->
        <tr align="center">
            <td>姓名</td>
            <td colspan="3" >{{teacher.name}}</td>
            <td colspan="3">性别</td>
            <td colspan="3" >{{teacher.gender}}</td>
            <td>年龄</td>
            <td colspan="3">
                <input v-model="age" type="number">
            </td>
            <td>职称</td>
            <td colspan="3">{{teacher.administrativeduty}}</td>
            <td>职务</td>
            <td colspan="2">{{teacher.duty}}</td>
        </tr>

        <!--工作量计算-->
        <tr>
            <td colspan="21" style="letter-spacing: 20px;font-weight:bold" align="center">
                工作量计算（标准课时）
            </td>
        </tr>

        <!--教学工作量-->
        <!--理论授课   指导实践课-->
        <tr align="center">
            <td :rowspan="workloadDTO.teachingWork.length+2" class="cell">教<br>学<br>工<br>作<br>量</td>
            <td colspan="13">理论授课</td>
            <td colspan="7">指导实践课</td>
        </tr>
        <!--班级  课程名称  计划课时数  合班课  课外实验  合计  课程设计与大型作业  校内实习实训  校外实习实训  毕业实践  合计 -->
        <tr align="center">
            <td colspan="3">班级</td>
            <td colspan="3">课程名称</td>
            <td colspan="2">计划课时数</td>
            <td colspan="2">合班课</td>
            <td>课外实验</td>
            <td colspan="2">合计</td>
            <td colspan="2">课程设计与大型作业</td>
            <td>校内实习实训</td>
            <td>校外实习实训</td>
            <td colspan="2">毕业实践</td>
            <td>合计</td>
        </tr>
        <tr align="center" v-for="(i,index) in workloadDTO.teachingWork.length" :key="index">
            <td colspan="3">
                <textarea v-model="workloadDTO.teachingWork[index].classes" ></textarea>
            </td>
            <td colspan="3">
                <textarea v-model="workloadDTO.teachingWork[index].courseName" ></textarea>
            </td>
            <td colspan="2">
                <textarea v-model="workloadDTO.teachingWork[index].classHourOfPlan" ></textarea>
            </td>
            <td colspan="2">
                <textarea v-model="workloadDTO.teachingWork[index].jojintClass" ></textarea>
            </td>
            <td>
                <textarea v-model="workloadDTO.teachingWork[index].extracurricularExperiment" ></textarea>
            </td>
            <td colspan="2" :rowspan="workloadDTO.teachingWork.length" v-if="index<1" height="100%">
                <input type="number" v-model="workloadDTO.sum1" ></input>
            </td>
            <td colspan="2">
                <textarea v-model="workloadDTO.teachingWork[index].courseDesign" ></textarea>
            </td>
            <td>
                <textarea v-model="workloadDTO.teachingWork[index].on_campusPractice" ></textarea>
            </td>
            <td>
                <textarea v-model="workloadDTO.teachingWork[index].off_campusTraining" ></textarea>
            </td>
            <td colspan="2">
                <textarea v-model="workloadDTO.teachingWork[index].graduationPractice" ></textarea>
            </td>
            <td :rowspan="workloadDTO.teachingWork.length" v-if="index<1">
                <input type="number" v-model="workloadDTO.sum2" ></input>
            </td>
        </tr>
        <tr align="center">
            <td></td>
            <td colspan="10">
                <button @click="add">添加</button>
                <button @click="del">删除</button>
            </td>
            <td>总计</td>
            <td colspan="8"></td>
            <td>
                <input type="number" v-model="workloadDTO.sum1AddSum2" ></input>
            </td>
        </tr>

        <!--教研科研工作量-->
        <!--序号  项目名称  项目摘要  项目完成情况  折算标准工作量  项目负责人  合计-->
        <tr align="center">
            <td :rowspan="workloadDTO.tseswdas.length+2">教<br>研<br>科<br>研<br>工<br>作<br>量</td>
            <td>序号</td>
            <td colspan="5">项目名称</td>
            <td colspan="4">项目摘要</td>
            <td colspan="3">项目完成情况</td>
            <td colspan="3">折算标准工作量</td>
            <td colspan="3">项目负责人</td>
            <td>合计</td>
        </tr>
        <tr align="center" v-for="(i,index) in workloadDTO.tseswdas" :key="index+100">
            <td>{{index+1}}</td>
            <td colspan="5" height="75px">
                <textarea v-model="workloadDTO.tseswdas[index].rsrProjectName" ></textarea>
            <td colspan="4" height="75px">
                <textarea v-model="workloadDTO.tseswdas[index].rsrProjectBrief" ></textarea>
            </td>
            <td colspan="3" height="75px">
                <textarea v-model="workloadDTO.tseswdas[index].rsrProjectStatus" ></textarea>
            </td>
            <td colspan="3" height="75px">
                <textarea v-model="workloadDTO.tseswdas[index].rsrConversionWorkload" ></textarea>
            </td>
            <td colspan="3" height="75px">
                <textarea v-model="workloadDTO.tseswdas[index].rsrPProjectLeader" ></textarea>
            </td>
            <td :rowspan="workloadDTO.tseswdas.length+1" v-if="index<1" height="116px">
                <input type="number" v-model="workloadDTO.rsrWorkload" ></input>
            </td>
        </tr>
        <tr align="center">
            <td colspan="19">
                <button @click="add2">添加</button>
                <button @click="del2">删除</button>
            </td>
        </tr>

        <!--补助工作量-->
        <tr align="center">
            <td colspan="2" style="font-weight: bold">补助工作量</td>
            <td colspan="5">
                <input v-model="workloadDTO.subsidyworkloadDATA.rsrProjectName">
            </td>
            <td colspan="4">
                <input v-model="workloadDTO.subsidyworkloadDATA.rsrProjectBrief">
            </td>
            <td colspan="3">
                <input v-model="workloadDTO.subsidyworkloadDATA.rsrProjectStatus">
            </td>
            <td colspan="3">
                <input v-model="workloadDTO.subsidyworkloadDATA.rsrConversionWorkload">
            </td>
            <td colspan="3">
                <input v-model="workloadDTO.subsidyworkloadDATA.rsrPProjectLeader">
            </td>
            <td>
                <input type="number" v-model="workloadDTO.subsidyworkload">
            </td>
        </tr>

        <!--共计工作量-->
        <tr>
            <td colspan="20" style="letter-spacing: 20px;font-weight:bold" align="center">
                共计工作量
            </td>
            <td colspan="1" style="letter-spacing: 20px;font-weight:bold" align="center">
                <input type="number" v-model="workloadDTO.totalSum">
            </td>
        </tr>

        <!--教研室审核  系部审核-->
        <tr align="center">
            <td colspan="2">教研室审核</td>
            <td colspan="9"><input v-model="workloadDTO.sectionVerify"></td>
            <td colspan="2">系部审核</td>
            <td colspan="8"><input v-model="workloadDTO.instituteVerify"></td>
        </tr>


    </table>

    <div v-show="ifShow">
        <table id="table2" style="table-layout:fixed; overflow:hidden;width: 95%" border="1" bgcolor="#fff" cellspacing="0" align="center">
            <div align="center" style="font-size: 25px; margin-bottom: 15px;">湖南工业职业技术学院专业技术人员工作量申报/审核表</div>

            <div align="center" style="margin-bottom: 15px;">
                {{newWorkloadDTO.year}}年
                {{newWorkloadDTO.trem}}学期
                <u>&nbsp{{workloadDTO.institute}}&nbsp</u>学院&emsp;&emsp;&emsp;&emsp;
                <u>&nbsp{{workloadDTO.section}}&nbsp</u>教研室
            </div>

            <!--姓名 性别 年龄 职称 职务-->
            <tr align="center">
                <td>姓名</td>
                <td colspan="3" >{{teacher.name}}</td>
                <td colspan="3">性别</td>
                <td colspan="3" >{{teacher.gender}}</td>
                <td>年龄</td>
                <td colspan="3">
                    {{age}}
                </td>
                <td>职称</td>
                <td colspan="3">{{teacher.administrativeduty}}</td>
                <td>职务</td>
                <td colspan="2">{{teacher.duty}}</td>
            </tr>

            <!--工作量计算-->
            <tr>
                <td colspan="21" style="letter-spacing: 20px;font-weight:bold" align="center">
                    工作量计算（标准课时）
                </td>
            </tr>

            <!--教学工作量-->
            <!--理论授课   指导实践课-->
            <tr align="center">
                <td :rowspan="workloadDTO.teachingWork.length+2" class="cell">教<br>学<br>工<br>作<br>量</td>
                <td colspan="13">理论授课</td>
                <td colspan="7">指导实践课</td>
            </tr>
            <!--班级  课程名称  计划课时数  合班课  课外实验  合计  课程设计与大型作业  校内实习实训  校外实习实训  毕业实践  合计 -->
            <tr align="center">
                <td colspan="3">班级</td>
                <td colspan="3">课程名称</td>
                <td colspan="2">计划课时数</td>
                <td colspan="2">合班课</td>
                <td>课外实验</td>
                <td colspan="2">合计</td>
                <td colspan="2">课程设计与大型作业</td>
                <td>校内实习实训</td>
                <td>校外实习实训</td>
                <td colspan="2">毕业实践</td>
                <td>合计</td>
            </tr>
            <tr align="center" v-for="(i,index) in workloadDTO.teachingWork.length" :key="index">
                <td colspan="3">
                   {{workloadDTO.teachingWork[index].classes}}
                </td>
                <td colspan="3">
                    {{workloadDTO.teachingWork[index].courseName}}
                </td>
                <td colspan="2">
                    {{workloadDTO.teachingWork[index].classHourOfPlan}}
                </td>
                <td colspan="2">
                    {{workloadDTO.teachingWork[index].jojintClass}}
                </td>
                <td>
                    {{workloadDTO.teachingWork[index].extracurricularExperiment}}
                </td>
                <td colspan="2" :rowspan="workloadDTO.teachingWork.length" v-if="index<1" height="100%">
                    {{workloadDTO.sum1}}
                </td>
                <td colspan="2">
                    {{workloadDTO.teachingWork[index].courseDesign}}
                </td>
                <td>
                    {{workloadDTO.teachingWork[index].on_campusPractice}}
                </td>
                <td>
                    {{workloadDTO.teachingWork[index].off_campusTraining}}
                </td>
                <td colspan="2">
                    {{workloadDTO.teachingWork[index].graduationPractice}}
                </td>
                <td :rowspan="workloadDTO.teachingWork.length" v-if="index<1">
                    {{workloadDTO.sum2}}
                </td>
            </tr>
            <tr align="center">
                <td></td>
                <td colspan="10">
                </td>
                <td>总计</td>
                <td colspan="8"></td>
                <td>
                    {{workloadDTO.sum1AddSum}}
                </td>
            </tr>

            <!--教研科研工作量-->
            <!--序号  项目名称  项目摘要  项目完成情况  折算标准工作量  项目负责人  合计-->
            <tr align="center">
                <td :rowspan="workloadDTO.tseswdas.length+2">教<br>研<br>科<br>研<br>工<br>作<br>量</td>
                <td>序号</td>
                <td colspan="5">项目名称</td>
                <td colspan="4">项目摘要</td>
                <td colspan="3">项目完成情况</td>
                <td colspan="3">折算标准工作量</td>
                <td colspan="3">项目负责人</td>
                <td>合计</td>
            </tr>
            <tr align="center" v-for="(i,index) in workloadDTO.tseswdas" :key="index+100">
                <td>{{index+1}}</td>
                <td colspan="5" height="75px">
                    {{workloadDTO.tseswdas[index].rsrProjectName}}
                <td colspan="4" height="75px">
                    {{workloadDTO.tseswdas[index].rsrProjectBrief}}
                </td>
                <td colspan="3" height="75px">
                    {{workloadDTO.tseswdas[index].rsrProjectStatus}}
                </td>
                <td colspan="3" height="75px">
                    {{workloadDTO.tseswdas[index].rsrConversionWorkload}}
                </td>
                <td colspan="3" height="75px">
                    {{workloadDTO.tseswdas[index].rsrPProjectLeader}}
                </td>
                <td :rowspan="workloadDTO.tseswdas.length+1" v-if="index<1" height="116px">
                    {{workloadDTO.rsrWorkload}}
                </td>
            </tr>
            <tr align="center">
                <td colspan="19">
                </td>
            </tr>

            <!--补助工作量-->
            <tr align="center">
                <td colspan="2" style="font-weight: bold">补助工作量</td>
                <td colspan="5">
                    {{workloadDTO.subsidyworkloadDATA.rsrProjectName}}
                </td>
                <td colspan="4">
                    {{workloadDTO.subsidyworkloadDATA.rsrProjectBrief}}
                </td>
                <td colspan="3">
                    {{workloadDTO.subsidyworkloadDATA.rsrProjectStatus}}
                </td>
                <td colspan="3">
                    {{workloadDTO.subsidyworkloadDATA.rsrConversionWorkload}}
                </td>
                <td colspan="3">
                    {{workloadDTO.subsidyworkloadDATA.rsrPProjectLeader}}
                </td>
                <td>
                    {{workloadDTO.subsidyworkload}}
                </td>
            </tr>

            <!--共计工作量-->
            <tr>
                <td colspan="20" style="letter-spacing: 20px;font-weight:bold" align="center">
                    共计工作量
                </td>
                <td colspan="1" style="font-weight:bold" align="center">
                    {{workloadDTO.totalSum}}
                </td>
            </tr>

            <!--教研室审核  系部审核-->
            <tr align="center">
                <td colspan="2">教研室审核</td>
                <td colspan="9">{{workloadDTO.sectionVerify}}</td>
                <td colspan="2">系部审核</td>
                <td colspan="8">{{workloadDTO.instituteVerify}}</td>
            </tr>


        </table>
    </div>

    <div v-show="!ifShow" align="center">
        <button @click="save">保存</button>
        <button @click="print">打印</button>
        <button @click="reset">重置</button>
    </div>
</div>


</body>


<script type="text/javascript" th:src="@{/webjars/jquery/1.9.1/jquery.js}"></script>
<script type="text/javascript" th:src="@{/webjars/bootstrap/3.3.7/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/js/Apexchart.js}"></script>
<script type="text/javascript" th:src="@{/asserts/js/ready.min.js}"></script>
<script type="text/javascript" th:src="@{/js/axios.js}"></script>

<script>
    var app = new Vue({
        el: "#app",
        data() {
            return {
                ifShow:false,
                age:"",
                teacher:{},
                workloadDTO:{
                    section:" ",
                    institute:" ",
                    year:new Date().getFullYear(),
                    trem:"上",
                    // 教学工作量
                    teachingWork: [
                        {
                            classes: " ",
                            courseName: " ",
                            classHourOfPlan: " ",
                            jojintClass: " ",
                            extracurricularExperiment: " ",
                            courseDesign: " ",
                            on_campusPractice: " ",
                            off_campusTraining: " ",
                            GraduationPractice: " ",

                        }
                    ],
                    sum1: " ",
                    sum2: " ",
                    sum1AddSum2: " ",
                    // teach study section study work do amount
                    // 教研科研工作量
                    tseswdas:[
                        {
                            rsrProjectName:" ",
                            rsrProjectBrief:" ",
                            rsrProjectStatus:" ",
                            rsrConversionWorkload:" ",
                            rsrPProjectLeader:" "
                        }
                    ],
                    rsrWorkload:" ",
                    // 补助工作量 ...字段名懒得改了
                    subsidyworkloadDATA:{
                        rsrProjectName:" ",
                        rsrProjectBrief:" ",
                        rsrProjectStatus:" ",
                        rsrConversionWorkload:" ",
                        rsrPProjectLeader:" ",
                    },
                    subsidyworkload:" ",
                    // 总工作量
                    totalSum:" ",
                    // 教研室审核
                    sectionVerify:" ",
                    // 院系审核
                    instituteVerify:" "
                },
                newWorkloadDTO:{}
            }
        },
        methods: {
            add(){
                this.workloadDTO.teachingWork.push({});
            },
            del(){
                this.workloadDTO.teachingWork.pop();
            },
            add2(){
                this.workloadDTO.tseswdas.push({});
            },
            del2(){
                this.workloadDTO.tseswdas.pop();
            },
            save(){
                axios.post("/teacher/wordload",
                    this.workloadDTO
                ).then((data)=>{

                })
            },
            reset(){
                this.$set(this,'workloadDTO', JSON.parse(JSON.stringify(this.newWorkloadDTO)));
            },
            print(){
                this.ifShow = true;
                //打印前，先保存一下
                this.save();
                //1 秒 后调用打印
                setTimeout(
                    function(){
                        window.print();
                    },100);
            },
            updateWorkload(){

                this.workloadDTO.year = this.newWorkloadDTO.year;
                this.workloadDTO.trem = this.newWorkloadDTO.trem;

                this.getWorkload();
            },
            getWorkload(){
                axios.get("/teacher/wordloadData",
                    {
                        params:{
                            year:this.workloadDTO.year,
                            trem:this.workloadDTO.trem
                        }
                    }
                ).then((data) => {
                    this.teacher=data.data.extend.teacher;
                    var _Workerload  = data.data.extend.workloadDTO;
                    if(_Workerload==null){
                        //不用$set赋值 vue 视图 无法更新。。。
                        this.$set(this,'workloadDTO', JSON.parse(JSON.stringify(this.newWorkloadDTO)));
                    }else{
                        for (let key in _Workerload) {
                            this.$set(this.workloadDTO, key, _Workerload[key]);
                        }
                    }
                });
            }
        },
        mounted(){
            this.newWorkloadDTO = JSON.parse(JSON.stringify(this.workloadDTO))
            //加载初始信息
            this.getWorkload();
            this.print();
        }
    })
</script>



</html>